import React from "react";

import cssobj from "@/css/cmtlist.scss";
console.log(cssobj); //没有向外暴露内容,并且全局生效
//webpack 默认只能打包.js 文件，需要打包css我要安装并且配置loader
//评论项 子组件 无状态
import CmtItem2 from "@/componets/CmtItem2";

// 引用某个包时，这个包前面的node_modules可以省略，直接以包名开始
import "bootstrap/dist/css/bootstrap.css";

export default class Cmtlist2 extends React.Component {
  constructor() {
    super();
    this.state = {
      CommentList: [
        { id: 1, user: "张三", content: "哈哈，沙发" },
        { id: 2, user: "李四", content: "哈哈，板凳" },
        { id: 3, user: "王五", content: "哈哈，凉席" },
        { id: 4, user: "赵六", content: "哈哈，拖鞋" },
        { id: 5, user: "田七", content: "哈哈，楼上的别跑" },
      ],
    };
  }
  render() {
    return (
      <div>
        <h1 className={cssobj.title}>这是评论列表父组件</h1>

        <button className="btn btn-success">yoyoyo</button>
        <div className="panel panel-primary"></div>
        {this.state.CommentList.map((item, index) => {
          return <CmtItem2 {...item} key={item.id}></CmtItem2>;
        })}
      </div>
    );
  }
}
